package com.coolingme.signin;

/**
 * 第三方登录实现类，扩展之前的登录接口
 * 装饰器可以覆盖或重用原来的方法，也可以扩展新的方法
 *
 * @author wangyue
 * @date 2020/9/16 10:48
 */
public class SignInForThirdServiceImpl implements ISignInForThirdService {

    /**
     * 原来的接口对象
     */
    private ISignInService signInService;

    public SignInForThirdServiceImpl(ISignInService signInService) {
        this.signInService = signInService;
    }


    @Override
    public ResultMsg register(String username, String password) {
        return signInService.register(username, password);
    }

    @Override
    public ResultMsg login(String username, String password) {
        return signInService.login(username, password);
    }

    @Override
    public ResultMsg loginForQQ(String id) {
        return new ResultMsg(200, "success", "QQ登录成功");
    }

    @Override
    public ResultMsg loginForWeChat(String id) {
        return new ResultMsg(200, "success", "WeChat登录成功");
    }

    @Override
    public ResultMsg loginForToken(String token) {
        return new ResultMsg(200, "success", "自动登录成功");
    }

    @Override
    public ResultMsg loginForPhone(String phone, String code) {
        return new ResultMsg(200, "success", "手机登录成功");
    }

    @Override
    public ResultMsg loginForRegister(String username, String password) {
        return new ResultMsg(200, "success", "注册后自动登录成功");
    }

}
